package com.jinzhi.jzweb.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.jinzhi.common.base.CoreServiceImpl;
import com.jinzhi.jzapi.examination.pojo.ExaminationsPercentVo;
import com.jinzhi.jzapi.examination.pojo.ExaminationsVo;
import com.jinzhi.jzweb.dao.ExaminationBatchDao;
import com.jinzhi.jzweb.domain.ExaminationBatchDO;
import com.jinzhi.jzweb.service.ExaminationBatchService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 
 * <pre>
 * 考试批次
 * </pre>
 * <small> 2020-02-24 21:00:12 | lance</small>
 */
@Service
public class ExaminationBatchServiceImpl extends CoreServiceImpl<ExaminationBatchDao, ExaminationBatchDO> implements ExaminationBatchService {
    @Override
    public List<Map<Object,Object>> selByAll(){
        return baseMapper.selByAll();
    }

    @Override
    public ExaminationsVo selExaminations(){
        return baseMapper.selExaminations();
    }
    
    @Override
    public List<ExaminationBatchDO> selExamNowList(){
    	return baseMapper.selExamNowList();
    }

    @Override
    public List<ExaminationsVo> selListExaminationsNowCeshi() {
        return baseMapper.selListExaminationsNowCeshi();
    }

    @Override
    public List<ExaminationsVo> selListExaminationsNow(){
        return this.baseMapper.selListExaminationsNow();
    }

    @Override
    public List<ExaminationsVo> selListExaminationsNowJs(){
        return this.baseMapper.selListExaminationsNowJs();
    }

    @Override
    public Long findByCbatchId(String id) {
        return baseMapper.findByCbatchId(id);
    }

    @Override
    public Page<Map<Object,Object>> selByNameCbatchId(int current, int number, String name,String cbatchId) {

        Page<Map<Object,Object>> page = new Page<>(current, number);

        List<Map<Object,Object>> list;
        if(StringUtils.isNotBlank(cbatchId)){
            list = this.baseMapper.selByNameCbatchId(page,name,Long.parseLong(cbatchId));
        }else{
            list = this.baseMapper.selByNameNoCbatchId(page,name);
        }
        return page.setRecords(list);
    }


    @Override
    public Page<Map<Object,Object>> selByNameCbatchId2(int current, int number, String name,String cbatchId) {

        Page<Map<Object,Object>> page = new Page<>(current, number);

        List<Map<Object,Object>> list;
        if(StringUtils.isNotBlank(cbatchId)){
            list = this.baseMapper.selByNameCbatchId2(page,name,Long.parseLong(cbatchId));
        }else{
            list = this.baseMapper.selByNameNoCbatchId2(page,name);
        }
        return page.setRecords(list);
    }

    @Override
    public List<ExaminationBatchDO> selListExamBatch(Map map){
        return this.baseMapper.selListExamBatch(map);
    }

    //查询下拉框对应的考试批次
    @Override
    public List<Map<Object,Object>> selTimeAll(String type,String name,String all) {

        return baseMapper.selBatchTimeAll(type,name,all);
    }

    //查询每一批次学生人数、学生理论成绩大于0人数、学生理论成绩大于0占比率
    @Override
    public List<ExaminationsPercentVo> selecltPercent(List list) {

        return baseMapper.selecltPercentList(list);
    }

    //查询每一批次学生人数、学生实操成绩大于0人数、学生实操成绩大于0占比率
    @Override
    public List<ExaminationsPercentVo> selecltPercent1(List list) {

        return baseMapper.selecltPercentList1(list);
    }

    @Override
    public List<ExaminationsVo> selListExaminationsTeachers() {
        return baseMapper.selListExaminationsTeachers();
    }

    @Override
    public List<ExaminationsVo> selListExaminationsScreen() {
        return baseMapper.selListExaminationsScreen();
    }
}
